checkVersion();

function checkVersion() {
    const v = process.version.split(".")[0].slice(1);
    if (v < 15) throw new Error("You current Node.js version too low, need upgrade to v15.0.0+");
}

const promise1 = Promise.reject(42);
const promise2 = Promise.reject({ answer: "foobar" })
const promise3 = new Promise((resolve, reject) => setTimeout(reject, 500, "failure"));

const promises = [promise1, promise2, promise3];
Promise.any(promises).then(value => console.log(value))
    .catch(printError);

function printError(err) {
    console.log("instanceof AggregateError: ", err instanceof AggregateError);
    console.log("err.message:", err.message);
    console.log("err.errors:", err.errors);
}
